<!-- 
使用方法:
import Button1 from '@/components/button1.vue'

<Button1>
    <div>
        按钮上的文字
    </div>
</Button1> 
-->

<template>
    <div class="btn-1">
        <span class="btn-1-front">
            Go!
        </span>
        <span class="btn-1-back">
            <slot>
            </slot>
        </span>
    </div>
</template>

<script setup>

</script>


<style scoped>
.btn-1 {
    position: relative;
    border: none;
    box-shadow: none;
    width: 100px;
    height: 40px;
    line-height: 42px;
    -webkit-perspective: 230px;
    perspective: 230px;
    display: flex;  
    align-items: center;  
    justify-content: center; 
    cursor: pointer;
}

.btn-1-back,
.btn-1-front {
    background: rgb(255, 181, 199);
    display: block;
    position: absolute;
    width: 100px;
    height: 40px;
    box-shadow: inset 2px 2px 2px 0px rgba(255, 255, 255, .5),
        7px 7px 20px 0px rgba(0, 0, 0, .1),
        4px 4px 5px 0px rgba(0, 0, 0, .1);
    border-radius: 5px;
    margin: 0;
    text-align: center;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-transition: all .3s;
    transition: all .3s;
}

.btn-1-front {
    box-shadow:
        -7px -7px 20px 0px #fff9,
        -4px -4px 5px 0px #fff9,
        7px 7px 20px 0px #0002,
        4px 4px 5px 0px #0001;
    -webkit-transform: rotateX(90deg);
    -moz-transform: rotateX(90deg);
    transform: rotateX(90deg);
    -webkit-transform-origin: 50% 50% -20px;
    -moz-transform-origin: 50% 50% -20px;
    transform-origin: 50% 50% -20px;
}

.btn-1-back {
    -webkit-transform: rotateX(0deg);
    -moz-transform: rotateX(0deg);
    transform: rotateX(0deg);
    -webkit-transform-origin: 50% 50% -20px;
    -moz-transform-origin: 50% 50% -20px;
    transform-origin: 50% 50% -20px;
}

.btn-1:hover .btn-1-front {
    box-shadow: inset 2px 2px 2px 0px rgba(255, 255, 255, .5),
        7px 7px 20px 0px rgba(0, 0, 0, .1),
        4px 4px 5px 0px rgba(0, 0, 0, .1);
    -webkit-transform: rotateX(0deg);
    -moz-transform: rotateX(0deg);
    transform: rotateX(0deg);
}

.btn-1:hover .btn-1-back {
    box-shadow: inset 2px 2px 2px 0px rgba(255, 255, 255, .5);
    color: transparent;
    -webkit-transform: rotateX(-90deg);
    -moz-transform: rotateX(-90deg);
    transform: rotateX(-90deg);
}
</style>
